<template>
  <editor-layout :show-ok-btn="false" cancel-text="关闭" v-on="$listeners" v-loading="loading">
    <div v-html="content">
    </div>
  </editor-layout>
</template>

<script>

/**
 * Created by Administrator on 2021/8/2
 */
import {getSysContentInfoId} from '$my/code/api/content'

export default {
  name: 'view',
  props: {
    id: String
  },
  data() {
    return {
      loading: false,
      content: ''
    }
  },
  methods: {
    async init() {
      if (this.id) {
        this.loadForm()
      }
    },
    async loadForm() {
      this.loading = true
      const data = await getSysContentInfoId(this.id).catch(e => {
        this.loading = false
        throw new Error(e)
      })
      this.content = data.content

      this.loading = false
    }
  },
  mounted() {
    this.init()
  }
}
</script>

<style lang="scss" scoped>
.edit {
}
</style>
